﻿@model FashionWebsite.Models.page<FashionWebsite.Models.Product>
@{
    Layout = null;
}
<script type="text/javascript">
        $().ready(function () {
            $(".page-number").live("click", function () {

                var pageindex = parseInt($(this).html());

                $.ajax({
                    url: '@Url.Action("PersonList")',
                    data: { "page": pageindex },
                    success: function (data) {
                        $("#person-list").html(data);
                    }
                });
            });
        });
</script>
  <div id="person-list">

    <table>
    <thead>
        <tr>
            <th>
                Forename
            </th>
            <th>
                Surname
            </th>
            <th>
                Location
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var person in Model.Data)
        {
            <tr>
                <td>
                    @person.ProductId

                </td>
                <td>
                    @person.ProductName
                </td>
                <td>
                    @person.ProducerId
                </td>
            </tr>
        }
    </tbody>
    <tfoot>
        <tr>
            <td colspan="3">
                @for (int i = 1; i <= Model.NumberOfPages; i++)
                {
                    if (i == Model.CurrentPage)
                    {
                        @i
                    }
                    else
                    {
                        <a class="page-number" href="javascript:void();">@i</a>
                    }
                }
            </td>
        </tr>
    </tfoot>
    </table>
         
   </div>

